package org.example.controller;

import lombok.extern.slf4j.Slf4j;
import org.example.serivce.ISysUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/sys/user")
@Slf4j
public class SysUserController {

    private static final Logger LOGGER = LoggerFactory.getLogger(SysUserController.class);

    @Resource
    private ISysUserService sysUserService;

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public String testDB(@RequestParam(name="num", defaultValue="1") Integer num, HttpServletRequest req){

        for (int i = 0; i < num; i++) {
            Thread thread = new Thread(){
                @Override
                public void run() {
                    sysUserService.selectAll();
                }
            };
            thread.start();
        }

        return "success";
    }


}
